package com.hlt.shuiliting.dao;

import java.util.List;

import com.hlt.shuiliting.database.DBUtil;

public class QiYeDAO {
	
	private int updateCount;
	private int pageCount;
	
	public int insert(Object[] params) {
		String sql = "insert into QiYe values(seq_QiYe.Nextval, '', sysDate, '', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), to_date(?, 'YYYY-MM-DD'), ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), ?, ?, ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), to_date(?, 'YYYY-MM-DD'), ?, to_date(?, 'YYYY-MM-DD'), ?)";
		DBUtil myDB = new DBUtil();
		myDB.doPstm(sql, params);
		updateCount = myDB.getUpdateCount();
		return updateCount;
	}
	
	//values(seq_QiYe.Nextval, '', sysDate, '', , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), to_date(?, 'YYYY-MM-DD'), ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), ?, ?, ?, ?, ?, ?, ?, to_date(?, 'YYYY-MM-DD'), to_date(?, 'YYYY-MM-DD'), ?, to_date(?, 'YYYY-MM-DD'), ?
	public int update(Object[] params) {
		String sql = "update QiYe set QiYeMC = ?,ZhuZiDMZH = ?,QiYeXZ = ?,HangYeLX = ?,FaRenDBMC = ?,JiShuFZRMC = ?,JingYingFZRMC = ?,QiYeZS = ?,QiYeBGDH = ?,YingYeZZBM = ?,ZhuCeJG = ?,ChengLiRQ = to_date(?, 'YYYY-MM-DD'),JingYingYXQX = to_date(?, 'YYYY-MM-DD'),ZhuCeZBJ = ?,GongShangNJJG = ?,ShuiWuDJJG = ?,ShuiWuDJZH = ?,AnQuanSCXKZH = ?,AnQuanSCXKZYXQX = to_date(?, 'YYYY-MM-DD'),FaZhengJGMC = ?,ShiFouXQ = ?,XingYongDJ = ?,ZhiLiangBZTXRZMC = ?,RenZhengBZ = ?,RenZhengJG = ?,RenZhengZH = ?,PiZhunSJ = to_date(?, 'YYYY-MM-DD'),RenZhengYXQX = to_date(?, 'YYYY-MM-DD'),XinYongPJ = ?,BeiAnRQ = to_date(?, 'YYYY-MM-DD'),QiYeWZ = ? where ID = ?";
		DBUtil myDB = new DBUtil();
		myDB.doPstm(sql, params);
		updateCount = myDB.getUpdateCount();
		return updateCount;
	}
	public List list() {
		String sql = "select * from QiYe";
		DBUtil myDB = new DBUtil();
		Object[] params = null;
		myDB.doPstm(sql, params);
		List list = myDB.getResultSet();
		myDB.closed();
		return list;
	}
	
	public List list(int pageSize , int pageNum) {
		String sql = "select * from QiYe";
		DBUtil myDB = new DBUtil();
		Object[] params = null;
		myDB.doPstm(sql, params);
		List list = myDB.getResultSet(pageSize, pageNum);
		pageCount = myDB.getPageCount();
		myDB.closed();
		return list;
	}
	
	public int getPageCount() {
		return pageCount;
	}
}
